////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   FA PRINT
// AUTHOR           :   Saint Peng
// DATE CREATE      :   2006/06/21
// DESCRIPTION      :   FA PRINT FUNCTION
//                  :
//                  :
//                  :
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2006/06/21   Saint Peng      1.0                 Bugzilla #5967, #6018, #6045, #5609
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.common.web;

import com.erp.app.common.ProjectPrintFormConstants;
import com.erp.framework.model.schema.TableSchema;
import com.erp.framework.util.CommonUtil;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Image;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
public class CustomPdfTable extends PdfPTable {
	public Phrase PHRASE_EMPTY = new Phrase("");
	
	/**
	 * CustomPdfTable Constructor
	 */
	public CustomPdfTable(int arg0) {
        super(arg0);
    }
	
	public CustomPdfTable(float[] arg0) {
        super(arg0);
    }
	
	//Init PdfTable with spacing after information   
	public CustomPdfTable(float[] arg0, float space) {
	    super(arg0);
	    this.setSpacingAfter(space);
	}
	
	//	Init PdfTable with spacing after information   
	public CustomPdfTable(float[] arg0, float spaceAfter, float spaceBefore) {
	    super(arg0);
	    this.setSpacingAfter(spaceAfter);
	    this.setSpacingBefore(spaceBefore);
	}
	/**
	 * Customize Specific CustomPdfTable
	 */
	public CustomPdfTable getOneLineTableWithCharacter(float[] width, int characterCell, String character, Font characterfont) {
		CustomPdfTable table = null;
		PdfPCell cell = null;
		if (characterCell > width.length - 1) {
			return null;
		}
		table = new CustomPdfTable(width.length);
		for (int i = 0; i < width.length; i++) {
			if (i == characterCell) {
				cell = new PdfPCell(new CustomParagraph(character, characterfont));
				cell.setBorder(Rectangle.NO_BORDER);
				table.addCell(cell);
			} else {
				table.addCell(getNoBorderBlankCell());
			}
		}
		return table;
	}

	public CustomPdfTable getOneTableWithCharacterFontBold9NoBorder(String character) {
		float[] width = { 1.00f };
		return getOneLineTableWithCharacter(width, 0, character, ProjectPrintFormConstants.FONT_DEFAULT_TABLE_CELL_FONT_BOLD);
	}

	public CustomPdfTable getOneTableNotWithCharacter() {
		float[] width = { 1.00f };
		return getOneLineTableWithCharacter(width, 0, "", ProjectPrintFormConstants.FONT_DEFAULT_TABLE_CELL_FONT_BOLD);
	}

	public CustomPdfTable getOneTableWithOneCell(PdfPCell cell) {
		CustomPdfTable table = null;
		float[] width = { 1.00f };
		table = new CustomPdfTable(width.length);
		table.addCell(cell);
		return table;
	}
	
	public CustomPdfTable createDefaultPTable(float[] widths) throws DocumentException{	            
	    return createLargePTable(widths);
	}
	
	public CustomPdfTable createSmallPTable(float[] widths) throws DocumentException{	            
	    return createPTable(widths, 25.0f);
	}
	
	public CustomPdfTable createMediumPTable(float[] widths) throws DocumentException{	            
	    return createPTable(widths, 50.0f);
	}
	
	public CustomPdfTable createLargePTable(float[] widths) throws DocumentException{	            
	    return createPTable(widths, 100.0f);
	}
	
	public CustomPdfTable createPTable(float[] widths, float widthPercent) throws DocumentException{	            
	    CustomPdfTable table = new CustomPdfTable(widths.length);
	    table.setWidths(widths);
	    table.setWidthPercentage(widthPercent);	    
	    return table;
	}	
		
	
	/**
	 * Title Cell:Font size --19
	 */
	public void addTitleCellBold(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 19, hAlign, Rectangle.NO_BORDER, colspan);
	}

	public void addTitleCellBoldUnderLine(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.UNDERLINE, 19, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	/**
	 * Heading Cell: Font size -- 16
	 * 
	 */
	public void addHeadingCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addHeadingCellBold(cellStr);
	}
	
	public void addHeadingBoxCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addHeadingBoxCellBold(cellStr);
	}
	
	public void addHeadingBoxCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 16, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addHeadingBoxCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 16, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addHeadingCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addHeadingCell(Object obj, int colspan) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addHeadingCell(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 16, hAlign, Rectangle.NO_BORDER, colspan);
	}
		
	public void addHeadingCell(Object obj, String fontName) {
		addCell(obj, fontName, Font.NORMAL, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addHeadingCell(Object obj, String fontName, int colspan) {
		addCell(obj, fontName, Font.NORMAL, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addHeadingCell(Object obj, String fontName, int colspan, int hAlign) {
		addCell(obj, fontName, Font.NORMAL, 16, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addHeadingCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addHeadingCellBoldUnderLine(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.UNDERLINE, 16, hAlign, Rectangle.NO_BORDER, colspan);
	}	
	
	public void addHeadingCellBold(Object obj, int colspan) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addHeadingCellBold(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 16, hAlign, Rectangle.NO_BORDER, colspan);
	}
		
	public void addHeadingCellBold(Object obj, String fontName) {
		addCell(obj, fontName, Font.BOLD, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addHeadingCellBold(Object obj, String fontName, int colspan) {
		addCell(obj, fontName, Font.BOLD, 16, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addHeadingCellBold(Object obj, String fontName, int colspan, int hAlign) {
		addCell(obj, fontName, Font.BOLD, 16, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addHeadingCellBoldItalic(Object obj,int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.ITALIC, 16, hAlign, Rectangle.NO_BORDER, colspan);
		
	}
	
	/**
	 * Large Cell: Font size -- 11
	 */
	public void addLargeCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addLargeCellBold(cellStr);
	}
	
	public void addLargeBoxCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addLargeBoxCellBold(cellStr);
	}
		
	public void addLargeBoxCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 11, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addLargeBoxCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 11, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addLargeCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addLargeCell(Object obj, int colspan) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addLargeCell(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 11, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addLargeCell(Object obj, String fontName) {
		addCell(obj, fontName, Font.NORMAL, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addLargeCell(Object obj, String fontName, int colspan) {
		addCell(obj, fontName, Font.NORMAL, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addLargeCell(Object obj, String fontName, int colspan, int hAlign) {
		addCell(obj, fontName, Font.NORMAL, 11, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addLargeCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addLargeCellBold(Object obj, int colspan) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addLargeCellBold(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 11, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addLargeCellBold(Object obj, String fontName) {
		addCell(obj, fontName, Font.BOLD, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addLargeCellBold(Object obj, String fontName, int colspan) {
		addCell(obj, fontName, Font.BOLD, 11, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addLargeCellBold(Object obj, String fontName, int colspan, int hAlign) {
		addCell(obj, fontName, Font.BOLD, 11, hAlign, Rectangle.NO_BORDER, colspan);
	}
	public void addLargeCellBoldUnderLine(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.UNDERLINE, 11, hAlign, Rectangle.NO_BORDER, colspan);
	}
		
	/**
	 * Medium Cell: Font size -- 9
	 */
	public void addMediumCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addMediumCellBold(cellStr);
	}
	
	public void addMediumBoxCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addMediumBoxCellBold(cellStr);
	}
	
	public void addMediumBoxCell(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelByObjectId(labelId);          
		addMediumBoxCellBold(cellStr);
	}
	
	public void addMediumBoxCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 9, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addMediumBoxCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 9, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addMediumBoxCellBold(Object obj,int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 9, hAlign, Rectangle.BOX, colspan);
	}
	public void addMediumCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	public void addMediumCell(Object obj, int colspan) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCell(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 9, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCell(Object obj, int colspan, int hAlign, float fixHeight) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 9, hAlign, Rectangle.NO_BORDER, colspan, fixHeight);
	}
	
	public void addMediumCell(Object obj, String fontName) {
		addCell(obj, fontName, Font.NORMAL, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addMediumCell(Object obj, String fontName, int colspan) {
		addCell(obj, fontName, Font.NORMAL, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCell(Object obj, String fontName, int colspan, int hAlign) {
		addCell(obj, fontName, Font.NORMAL, 9, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCellUnderLine(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL | Font.UNDERLINE, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	public void addMediumCellItalicUnderLine(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL | Font.UNDERLINE | Font.ITALIC, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addMediumCellItalic(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL | Font.ITALIC, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	public void addMediumCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	public void addMediumCellBold(Object obj, int colspan) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCellBold(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 9, hAlign, Rectangle.NO_BORDER, colspan);
	}
		
	public void addMediumCellBoldItalic(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.ITALIC, 9, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCellBold(Object obj, String fontName) {
		addCell(obj, fontName, Font.BOLD, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addMediumCellBold(Object obj, String fontName, int colspan) {
		addCell(obj, fontName, Font.BOLD, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCellBold(Object obj, String fontName, int colspan, int hAlign) {
		addCell(obj, fontName, Font.BOLD, 9, hAlign, Rectangle.NO_BORDER, colspan);
	}
	
	public void addMediumCellBoldUnderLine(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.UNDERLINE, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	public void addMediumCellBoldItalic(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.UNDERLINE | Font.ITALIC, 9, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	public void addNotFontMediumCell(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_TIMES_NEW_ROMAN, Font.NORMAL, 10, hAlign, Rectangle.NO_BORDER, colspan);
	}
	public void addNotFontMediumCellBold(Object obj, int colspan, int hAlign) {
		addCell(obj, ProjectPrintFormConstants.FONT_TIMES_NEW_ROMAN, Font.BOLD, 10, hAlign, Rectangle.NO_BORDER, colspan);
	}
	/**
	 * Small Cell:Font size --7
	 */	
	public void addSmallCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addSmallCellBold(cellStr);
	}
	
	public void addSmallBoxCellLabel(TableSchema ts, String labelId){
		String cellStr = ts.getDisplayWebLabelWithColonByObjectId(labelId);          
		addSmallBoxCellBold(cellStr);
	}

	public void addSmallBoxCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 7, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addSmallBoxCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 7, Element.ALIGN_LEFT, Rectangle.BOX);
	}
	
	public void addSmallCell(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL, 7, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addSmallCellUnderLine(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.NORMAL | Font.UNDERLINE, 7, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addSmallCellBold(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD, 7, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	public void addSmallCellBoldUnderLine(Object obj) {
		addCell(obj, ProjectPrintFormConstants.FONT_DEFAULT, Font.BOLD | Font.UNDERLINE, 7, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
	}
	
	/**
	 * Image Cell
	 * 
	 */
	public void addImageToCell(byte[] byteImage, float height) throws Exception {
		addImageToCell(byteImage, height, Element.ALIGN_CENTER, Element.ALIGN_TOP, Rectangle.NO_BORDER);
	}
	
	public void addImageToCellWithBorder(byte[] byteImage, float height) throws Exception {
		addImageToCell(byteImage, height, Element.ALIGN_CENTER, Element.ALIGN_TOP, Rectangle.BOX);
	}
	
	public void addImageToCell(byte[] byteImage) throws Exception {
		addImageToCell(byteImage, 80.0f, Element.ALIGN_CENTER, Element.ALIGN_TOP, Rectangle.NO_BORDER);
	}
	
	public void addImageToCellWithBorder(byte[] byteImage) throws Exception {
		addImageToCell(byteImage, 80.0f, Element.ALIGN_CENTER, Element.ALIGN_TOP, Rectangle.BOX);
	}
	
	public void addImageToCell(byte[] byteImage, float height, int horizAlign, int vertiAlign, int border) throws Exception {
		PdfPCell cell = null;
		Image image = null;
		try {
			if (byteImage != null && byteImage.length > 0) {
				image = Image.getInstance(byteImage);
			}

			cell = new PdfPCell(image, true);
			cell.setFixedHeight(height);
			cell.setHorizontalAlignment(horizAlign);
			cell.setVerticalAlignment(vertiAlign);
			cell.setBorder(border);

			super.addCell(cell);
		} catch (Exception e) {
			throw e;
		}
	}
	
	/**
	 * Special and Common Use Cell
	 */
	public PdfPCell getNoBorderBlankCell() {

		return getCharacterCell("", 0, "", null);
	}
	
	public void addDoubleSolidBorder(float borderWidth) {
		PdfPCell cell = new PdfPCell(new CustomParagraph(""));
		cell.setBorder(Rectangle.NO_BORDER);
		cell.setBorderWidthTop(borderWidth);
		cell.setBorderWidthBottom(borderWidth);
		super.addCell(cell);
		
	}
	public PdfPCell getCharacterCell(String borderLocate, float border, String character, Font characterfont) {

		PdfPCell cell = null;
		if (!CommonUtil.isEmpty(character)) {
			cell = new PdfPCell(new CustomParagraph(character, characterfont));
		} else {
			cell = new PdfPCell(new CustomParagraph(""));
		}
		cell.setBorder(Rectangle.NO_BORDER);
		if (ProjectPrintFormConstants.BORDER_TOP.equals(borderLocate))
			cell.setBorderWidthTop(border);
		else if (ProjectPrintFormConstants.BORDER_BOTTOM.equals(borderLocate)) {
			cell.setBorderWidthBottom(border);
		} else if (ProjectPrintFormConstants.BORDER_LEFT.equals(borderLocate)) {
			cell.setBorderWidthLeft(border);
		} else if (ProjectPrintFormConstants.BORDER_RIGHT.equals(borderLocate)) {
			cell.setBorderWidthRight(border);
		}

		return cell;
	}

	public PdfPCell getCharacterCellWithTopBorder(float border, String character, Font characterfont) {
		return getCharacterCell(ProjectPrintFormConstants.BORDER_TOP, border, character, characterfont);
	}
    
    /**
     * Empty Cell
     */
	public void addEmptyCell(float fixedHeight){
		PdfPCell cell = new PdfPCell(PHRASE_EMPTY);
		cell.setBorder(Rectangle.NO_BORDER);
		cell.setFixedHeight(fixedHeight);
		super.addCell(cell);		
	}

	public void addEmptyCell() {
		PdfPCell cell = new PdfPCell(PHRASE_EMPTY);
		cell.setBorder(Rectangle.NO_BORDER);
		super.addCell(cell);
	}
	
	public void addNEmptyCell(int no) {
		for(int i = 0; i < no; i++){
			addEmptyCell();
		}
	}

	public void addNEmptyCell(int no, float fixedHeight) {
		for(int i = 0; i < no; i++){
			addEmptyCell(fixedHeight);
		}
	}

	public void addBoxEmptyCell(float fixedHeight) {
		PdfPCell cell = new PdfPCell(PHRASE_EMPTY);
		cell.setBorder(Rectangle.BOX);
		cell.setFixedHeight(fixedHeight);
		super.addCell(cell);
	}	
	
	public void addBoxEmptyCell() {
		PdfPCell cell = new PdfPCell(PHRASE_EMPTY);
		cell.setBorder(Rectangle.BOX);
		
		super.addCell(cell);
	}
	
	public void addBoxNEmptyCell(int no) {
		for(int i = 0; i < no; i++){
			addBoxEmptyCell();
		}
	}

	public void addBoxNEmptyCell(int no, float fixedHeight) {
		for(int i = 0; i < no; i++){
			addBoxEmptyCell(fixedHeight);
		}
	}		
    /**
     * Default Cell--medium cell
     */
    public void addDefaultBoxCell(Object obj) {
    	addMediumBoxCell(obj);
	}
    
    public void addDefaultBoxCellBold(Object obj) {
    	addMediumBoxCellBold(obj);
	}
	
	public void addDefaultCell(Object obj) {
		addMediumCell(obj);
	}
	
	public void addDefaultCellBold(Object obj) {
		addMediumCellBold(obj);
	}

	/**
	 * Customize Specific Cell
	 */
	public void addCell(Object obj, String fontName, int fontStyle, int fontSize, int align, int border) {
		String cellStr = CommonUtil.nullToString(obj);
		PdfPCell cell = new PdfPCell(new Phrase(cellStr, FontFactory.getFont(fontName, fontSize, fontStyle)));
		
		cell.setBorder(border);
		cell.setHorizontalAlignment(align);
		super.addCell(cell);
	}
	
	public void addCell(Object obj, String fontName, int fontStyle, int fontSize,
			int align, int border, int colspan) {
		String cellStr = CommonUtil.nullToString(obj);
		PdfPCell cell = new PdfPCell(new Phrase(cellStr, FontFactory.getFont(fontName, fontSize, fontStyle)));
		
		cell.setBorder(border);
		cell.setHorizontalAlignment(align);
		cell.setColspan(colspan);
		super.addCell(cell);
	}
	
	public void addCell(Object obj, String fontName, int fontStyle, int fontSize,
			int align, int border, int colspan, float fixHeight) {
		String cellStr = CommonUtil.nullToString(obj);
		PdfPCell cell = new PdfPCell(new Phrase(cellStr, FontFactory.getFont(fontName, fontSize, fontStyle)));
		
		cell.setBorder(border);
		cell.setHorizontalAlignment(align);
		cell.setColspan(colspan);
		cell.setFixedHeight(fixHeight);
		super.addCell(cell);
	}
	
	public void addCell(CustomPdfTable table, int border, int fixHeight){
		PdfPCell cell = new PdfPCell(table);
		cell.setBorder(border);
		if(fixHeight != 0) {
			cell.setFixedHeight(fixHeight);
		}
		super.addCell(cell);
	}
	
}